#ifndef REGEX_VM_H
#define REGEX_VM_H
enum instruction_type{
    i_char=1,
    i_word=2,
    i_number=3,
    i_split = 4,
    i_match = 5,
    i_jmp = 6,
    i_nop=7,
    i_space=8,
    i_any=9,
    i_nonespace=10
};
typedef struct _instruction{
    enum instruction_type type;
    unsigned char c;
    struct _instruction *op1;
    struct _instruction *op2;
    struct _instruction *next;
} instruction;

typedef struct _regex_result{
    int start;
    int end;
    struct _regex_result *next;
} regex_result;

typedef struct _regex_thread{
    instruction *op;
    int pos;
} regex_thread;

instruction* make_instruction(enum instruction_type type);
regex_result* make_result(int start,int end);
regex_thread* make_thread(instruction *op,int pos);
regex_result* regex_match(instruction* ,char* s,int length);
void display_result(regex_result*);
#endif